Method and apparatus for paying fare

ABSTRACT

Some embodiments of the application disclose a method and apparatus for paying a fare. When a user takes a public transit means, the user terminal establishes an NFC connection with the fare-collecting device of the public transit means, the user terminal transmits the encrypted account ID of the user to the fare-collecting device, and the fare-collecting device may request a server to deduct the fare from the account of the user.

CROSS REFERENCE TO RELATED APPLICATION

The present application is a continuation application of International Patent Application No. PCT/CN2018/105951, filed on Sep. 17, 2018, which claims priority to Chinese Patent Application No. 201711054359.7, filed on Oct. 31, 2017. The entire content of the above referenced applications is incorporated herein by reference.

TECHNICAL FIELD

The application relates to the field of information technology, and in particular relates to a method and apparatus for paying a fare.

BACKGROUND

Currently, the method of using the near field communication (NFC) function of a user terminal (for example, a mobile phone) to simulate the user terminal has come into use (e.g., as shown in FIG. 1, a mobile phone may be simulated into a public transit card so that the user can take a public transit means by “swiping the mobile phone.”).

Generally, the user terminal which simulates a public transit card must have at least the following three hardware units: NFC front-end chip, NFC antenna and security chip. Among them, the NFC front-end chip and the NFC antenna are used to realize NFC communication, and the account ID and account balance of the public transit card are stored in the security chip in the form of hardware encryption, that is, the function of the security chip is to prevent the account balance from being maliciously tampered.

When using a user terminal to takes a public transit means, a user moves the user terminal close to a fare-collecting device of the public transit means, the fare-collecting device establishes an NFC connection with the user terminal, and the fare-collecting device has the permission to update the account balance stored in the security chip in the user terminal (for example, rewrite RMB100 into RMB98) over the NFC connection to collect the fare.

Based on the prior art, a low-cost method for paying a fare is desired.

SUMMARY

Some embodiments of the application provide a method and apparatus for paying a fare to solve the problem with the prior high-cost method for paying a fare.

To solve the above-mentioned technical problem, some embodiments of the application are realized in such a way:

The method for paying a fare in some embodiments of the application comprises: establishing, by a fare-collecting device of a public transit means, a near field communication (NFC) connection with a user terminal; receiving over the NFC connection encrypted data transmitted from the user terminal; decrypting the encrypted data to obtain an account ID of a user associated with the user terminal; and determining whether to send the account ID to a server for the server to deduct a fare from an account corresponding to the account ID.

In some embodiments, decrypting the encrypted data to obtain the account ID comprises: decrypting the encrypted data to obtain the account ID and a timestamp, and determining whether to send the account ID to the server comprises: determining whether a time interval between a time corresponding to the timestamp to a current time satisfies a condition; if yes, determining to send the account ID to the server; and if no, determining not to send the account ID to the server.

In some embodiments, decrypting the encrypted data to obtain the account ID further comprises: decrypting the encrypted data to obtain the account ID and a device ID, and determining whether to send the account ID to the server further comprises: determining whether the device ID is consistent with a device ID of the fare-collecting device; if yes, determining to send the account ID to the server; and if no, determining not to send the account ID to the server.

In some embodiments, in response to determining not to send the account ID to the server, the method further comprises at least one of the following: reporting an error; and closing an entrance.

In some embodiments, in response to determining to send the account ID to the server, the method further comprises opening the entrance.

In some embodiments, the encrypted data comprises: the account ID of the user associated with the user terminal and a timestamp corresponding to a time when the encrypted data is encrypted.

In some embodiments, the encrypted data comprises: the account ID of the user associated with the user terminal and a device ID of the fare-collecting device.

In another aspect of the present disclosure, a computing system may comprise one or more processors and one or more non-transitory computer-readable memories coupled to the one or more processors and configured with instructions executable by the one or more processors. Executing the instructions may cause the system to perform operations. The operations may include establishing, by a fare-collecting device of a public transit means, a near field communication (NFC) connection with a user terminal; receiving over the NFC connection encrypted data transmitted from the user terminal; decrypting the encrypted data to obtain an account ID of a user associated with the user terminal; and determining whether to send the account ID to a server for the server to deduct a fare from an account corresponding to the account ID.

Yet another aspect of the present disclosure is directed to a non-transitory computer-readable storage medium configured with instructions executable by one or more processors to cause the one or more processors to perform operations. The operations may include establishing, by a fare-collecting device of a public transit means, a near field communication (NFC) connection with a user terminal; receiving over the NFC connection encrypted data transmitted from the user terminal; decrypting the encrypted data to obtain an account ID of a user associated with the user terminal; and determining whether to send the account ID to a server for the server to deduct a fare from an account corresponding to the account ID.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe some embodiments of the application more clearly, the following briefly describes the drawings in the description of some embodiments. The drawings in the following description are used for illustration purpose, and do not limit the scope of this specification. Without creative work, those skilled in the art may obtain other drawings on the basis of these drawings.

FIG. 1 shows a method of paying a fare by simulating a mobile phone into a public transit card.

FIG. 2 is a flowchart of a method for paying a fare in some embodiments of the application.

FIG. 3 is a schematic diagram for an apparatus for paying a fare in some embodiments of the application.

FIG. 4 is a schematic diagram for another apparatus for paying a fare in some embodiments of the application.

FIG. 5 is a schematic diagram for a device for paying a fare in some embodiments of the application.

FIG. 6 is a schematic diagram for another device for paying a fare in some embodiments of the application.

DETAILED DESCRIPTION

Currently, a user terminal must have hardware units such as NFC front-end chip, NFC antenna and security chip so that the user can take a public transit means such as bus or subway by “swiping a mobile phone.” However, requiring a user terminal, for example, a mobile phone to have a security chip will lead to high hardware cost of the mobile phone, and furthermore, a large number of mobile phones available on the market have no security chip, and the users of these mobile phones may not be able to enjoy the convenience of taking a public transit means by “swiping a mobile phone.”

In some embodiments of the application, a user's account balance may not be stored in a user terminal. The account of the user may be maintained by a server. The NFC front-end chip and NFC antenna of the user terminal may be utilized so that the user terminal may establish an NFC connection with the fare-collecting device of a public transit means, where the user terminal transmits the account ID of the user to the fare-collecting device, and then the fare-collecting device requests the server to deduct a fare from the account corresponding to the account ID.

For the convenience of description, the public transit means in the following description is a subway. The technical solutions in some embodiments of the application are described in detail below in combination with the drawings.

FIG. 2 is a flowchart of a method for paying a fare in some embodiments of the application and the method comprises the following steps.

S200: A user terminal establishes an NFC connection with the fare-collecting device of a public transit means.

In some embodiments of the application, the user terminal may be a mobile phone, a tablet PC, a notebook PC or a smart device which may be applied in a mobile payment scenario. The fare-collecting device of the public transit means may be a subway gate or a card reader on a bus, and the fare-collecting device is a subway gate in the following description.

In this step, the user may move the user terminal close to the fare-collecting device, and when the distance between the user terminal and the fare-collecting device is not greater than the NFC induction distance, the user terminal may establish an NFC connection with the fare-collecting device.

The establishment of an NFC connection may be independent of the Internet or LAN, and therefore, when both the user terminal and the fare-collecting device are offline, an NFC connection may still be established between them.

S202: The user terminal encrypts the account ID of the user according to an encryption algorithm of the public transit system to obtain encrypted data.

S204: The user terminal transmits the encrypted data to the fare-collecting device over the NFC connection.

In some embodiments of the application, in order to prevent the account ID of the user from being maliciously intercepted during the transmission, the user terminal may encrypt the account ID of the user and transmit the encrypted data to the fare-collecting device over the NFC connection. In this way, even if the encrypted data is intercepted by a malicious user during the transmission, the lawbreaker cannot decrypt the encrypted data to obtain the account ID of the user.

The encryption algorithm the user terminal uses to encrypt the account ID in step S202 may be an encryption algorithm applicable to data transmission between the user terminal and the public transit means. The encryption algorithm may be executed by a payment application installed on the user terminal. The encryption algorithm may be agreed on in advance between the payment application and the public transit system (for example, a server of a subway corporation).

S206: The fare-collecting device receives over the NFC connection the encrypted data transmitted from the user terminal.

S208: The fare-collecting device decrypts the encrypted data to obtain the account ID.

S210: The fare-collecting device determines whether to send the account ID to a server for the server to deduct a fare from an account corresponding to the account ID.

In some embodiments of the application, the fare-collecting device may acquire the account ID after decrypting the encrypted data. Later, the fare-collecting may send the account ID obtained by decrypting the encrypted data to the server and the server may deduct the fare from the account corresponding to the account ID.

When a payment application is installed on the user terminal and the account ID is encrypted by the payment application, the server is the server corresponds to the payment application.

In addition, if the subway the user takes is in segment charging mode, the fare-collecting device may need to acquire over the NFC connection the encrypted data transmitted from the user terminal when the user enters and leaves a station (gets on and off when the user takes a bus). When the user enters a station, the fare-collecting device may make a record according to the account ID obtained by decrypting the encrypted data, and when the user leaves a station, the fare-collecting may calculate the fare according to the account ID obtained by decrypting the encrypted data and send the account ID and the fare to the server to cause the server to deduct the fare from the account corresponding to the account ID.

If the subway the user takes is in uniform charging mode (the fare is fixed regardless of the mileage), the fare-collecting device acquires the account ID and sends the account ID to the server when the user enters a station, and the server deducts the RMB2 fare from the account corresponding to the account ID.

In the prior method for paying a fare, a user terminal having the three hardware units of an NFC front-end chip, an NFC antenna and a security chip is equivalent to a public transit card, in which an account balance is stored, the user enters or leaves a station by moving the user terminal close to the induction zone of a subway gate, and the fare-collecting device may update the account balance stored in the security chip of the user terminal to complete fare deduction.

In some embodiments of the application, no account balance may be stored in a user terminal, the fare-collecting device may not directly perform a fare deduction operation, and the fare-collecting device may request the server to deduct a fare from the account of a user. The account ID of the user may be obtained by registering an account on the server. Therefore, the fare-collecting device may need to send the account ID sent by the user terminal to the server to request the server to deduct the fare from the account of the user. In this way, the fare-collecting device may complete a fare collection.

In addition, user A may theoretically use the encrypted data obtained by encrypting the account ID of user B to enter a station. That is, when user B enters a station, user A may intercept the encrypted data transmitted from the user terminal of user B to the fare-collecting device, and later use the encrypted data to enter the station, and the server may also deduct a fare from the account of user A.

To prevent this case, the user terminal may acquire the corresponding timestamp of the current time and encrypts the account ID of the user and the timestamp to obtain encrypted data in step S202. In step S208, the fare-collecting device may decrypt the encrypted data to obtain the account ID and the timestamp, and in step S210, the fare-collecting device may determine whether the time interval from the timestamp obtained by decrypting the encrypted data to the current time satisfies a specified condition. If yes, the fare-collecting device may send the account ID to the server, and if no, the fare-collecting device may refuse to send the account ID to the server. The specified condition may be a specified time length, and may be specified according to the requirement, for example, to be 5 seconds.

In this way, even if user B intercepts the encrypted data and later uses the encrypted data to enter a station, the fare-collecting device may determine that the encrypted data is invalid because of timeout and the fare-collecting device may refuse to send the account ID to the server.

In addition, when the encrypted data is obtained by the user terminal of user A by encrypting the account ID and the corresponding timestamp of the current time, user B may be prevented from later going into the station after intercepting the encrypted data. However, user B may use the intercepted encrypted data to enter the station from another subway gate at the moment when user A enters the station.

Therefore, in step S202, the user terminal may further acquire the device ID of the fare-collecting device and encrypt the account ID of the user, the corresponding timestamp of the current time and the device ID to obtain encrypted data. The user terminal may acquire the device ID over the established NFC connection. In step S208, the fare-collecting device may decrypt the encrypted data to obtain the account ID, timestamp and device ID. In step S210, the fare-collecting device not only needs to determine whether the time interval from the time corresponding to the timestamp obtained by decrypting the encrypted data to the current time satisfies a specified condition, but also needs to determine whether the device ID obtained by decrypting the encrypted data is consistent with its own device ID. If the two determination results are both yes, the fare-collecting device may send the account ID to the server, and if either determination result is no, the fare-collecting device may refuse to send the account ID to the server.

In this way, even if user B intercepts the encrypted data of user A and enters the station from another subway gate (or get on another bus) at the moment when user A enters the station, another subway gate may also determine that the device ID obtained by decrypting the encrypted data is not its own device ID and thus may refuse to send the account ID to the server.

In some embodiments, the timestamp and the device ID adopted in the above-mentioned technical means may be used separately. That is, the user terminal may encrypt the account ID and the corresponding timestamp of the current time to obtain encrypted data, or encrypt the account ID and the device ID of the fare-collecting device to obtain encrypted data.

In addition, in some embodiments of the application, when the fare-collecting device is online, the fare-collecting device may open the entrance and/or report no error to allow a user to enter a station or get on a bus while sending the account ID to the server. The fare-collecting device may report an error and/or close the entrance to prevent the user from entering the station or getting on the bus and refuse to send the account ID to the server.

When the fare-collecting device is offline, if the fare-collecting device refuses to send the account ID to the server, the fare-collecting device may report an error and/or close the entrance to prevent the user from going into the station or getting on the bus. If the fare-collecting device needs to send the account ID to the server, the fare-collecting device may first store the account ID to be sent and open the entrance and/or report no error to allow the user to go into the station or get on the bus. Then, the fare-collecting device may send the stored account ID to the server when it is connected to a network.

Through the method shown in FIG. 2, no security chip is required for a user terminal, and thus the corresponding hardware cost is saved. In addition, the account balance of a user is recorded and modified by the server, and the user may still take a public transit means by “swiping a mobile phone.” Even if the user terminal of the user has no security chip, the user may move the user terminal close to a subway gate to enter a station and experience the “touch payment.”

On the basis of the method for paying a fare in FIG. 2, some embodiments of the application further provide an apparatus for paying a fare accordingly. As shown in FIG. 3, the apparatus comprises: an establishment module 301, configured to establish an NFC connection with the fare-collecting device of a public transit means, an encryption module 302, configured to encrypt the account ID of a user according to the pre-agreed encryption algorithm of a public transit system to obtain encrypted data, and a transmission module 303, configured to transmit the encrypted data to the fare-collecting device over the NFC connection so that the fare-collecting device decrypts the encrypted data to obtain the account ID and sends the account ID to a server to cause the server to deduct a fare from the account corresponding to the account ID.

In some embodiments, the encryption module 302 may acquire the corresponding timestamp of the current time and encrypt the account ID of a user and the timestamp to obtain encrypted data.

In some embodiments, the encryption module 302 may acquire the device ID of the fare-collecting device over the NFC connection and encrypt the account ID of a user and the device ID to obtain encrypted data.

On the basis of the method for paying a fare in FIG. 2, some embodiments of the application further provide another apparatus for paying a fare accordingly. As shown in FIG. 4, the apparatus comprises: an establishment module 401, configured to establish an NFC connection with a user terminal, a receiving module 402, configured to receive over the NFC connection the encrypted data transmitted from the user terminal, a decryption module 403, configured to decrypt the encrypted data to obtain the account ID of the user, and a sending module 404, configured to send the account ID to a server so that the server deducts a fare from the account corresponding to the account ID.

The decryption module 403 may decrypt the encrypted data to obtain the account ID and the timestamp, and the sending module 404 may determine whether the time interval from the corresponding time of the timestamp to the current time satisfies a specified condition; if yes, the sending module may send the account ID to a server, and if no, the sending module may refuse to send the account ID to the server.

The decryption module 403 may decrypt the encrypted data to obtain the account ID and the device ID, and the sending module 404 may determine whether the device ID obtained from the decryption is consistent with its own device ID; if yes, the sending module may send the account ID to a server, and if no, the sending module may refuse to send the account ID to the server.

The sending module 404 may send the account ID to a server and open the entrance and/or reports no error, or refuse to send the account ID to the server and report an error and/or closes the entrance.

On the basis of the method for paying a fare in FIG. 2, some embodiments of the application further provide a device for paying a fare accordingly. As shown in FIG. 5, the device comprises one or more processors and a memory, a program is stored in the memory and the device is so configured that the one or more processors perform the following steps: establishing an NFC connection with the fare-collecting device of a public transit means, encrypting the account ID of the user according to the pre-agreed encryption algorithm of a public transit system to obtain encrypted data, and transmitting the encrypted data to the fare-collecting device over the NFC connection so that the fare-collecting device decrypts the encrypted data to obtain the account ID and sends the account ID to a server to cause the server to deduct a fare from the account corresponding to the account ID.

On the basis of the method for paying a fare in FIG. 2, some embodiments of the application further provide another device for paying a fare accordingly. As shown in FIG. 6, the device comprises one or more processors and a memory, a program is stored in the memory and the device is so configured that the one or more processors perform the following steps: establishing an NFC connection with a user terminal, receiving over the NFC connection the encrypted data transmitted from the user terminal, decrypting the encrypted data to obtain the account ID of the user, and sending the account ID to a server so that the server deducts a fare from the account corresponding to the account ID.

Some embodiments in the description are described in a progressive way. For the same or similar parts between some embodiments, refer to these embodiments. Each embodiment focuses the differences from the others. Especially, for the devices in FIGS. 5 and 6, since they are similar to the embodiment of the method, their descriptions are brief. The relevant embodiments of the devices may be referred to the descriptions of the embodiments of the method.

In the 1990s, it may be obvious whether a technical improvement is a hardware improvement (for example, improvement of the circuit structure of a diode, a transistor or a switch) or software improvement (for example, improvement of the method process). However, with the development of technologies, the improvements of today's method processes have already been considered as direct improvements of hardware circuit structures. Designers may almost obtain a hardware circuit structure by programming an improved method process into a hardware circuit. Therefore, the improvement of a method process may be realized by hardware entity modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA) is such an integrated circuit whose logic function is determined by programming the device. Designers may themselves program a digital system to “integrate” it into a PLD, without asking a chip manufacturer to design and manufacture an application specific integrated circuit (ASIC) chip. Nowadays, programming which replaces manual manufacturing of integrated circuit chips is mostly done by a logic compiler, which is similar to a software compiler used for program development and writing. Original codes before compilation also need to be written by use of a specific programming language, for example, hardware description language (HDL). However, HDL is not the only programming language, and many other programming languages, for example, Advanced Boolean Expression Language (ABEL), Altera Hardware Description Language (AHDL), Confluence, Cornell University Programming Language (CUPL), HDCal, Java Hardware Description Language (JHDL), Lava, Lola, MyHDL, PALASM, and Ruby Hardware Description Language (RHDL) may be used. Currently, Very-High-Speed Integrated Circuit Hardware Description Language (VHDL) and Verilog are the most commonly used. A hardware circuit realizing a logic method process may easily be obtained by using some of the above-mentioned hardware description languages to perform logic programming for the method process and program it into an integrated circuit.

A controller may be realized in a proper way. For example, a controller may be a microprocessor or processor, a computer-readable medium in which computer-readable program codes (for example, software or firmware) executed by the (micro)processor are stored, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller and an embedded micro controller. Examples of a controller include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, and a memory controller may be realized as a part of the control logic of the memory. Those skilled in the art also know that besides a controller may be realized in the way of computer-readable program codes, the same function may completely be realized in the form of a logic gate, switch, ASIC, programmable logic controller, embedded microcontroller through logic programming of the procedure of a method. Therefore, such a controller may be considered as a hardware component and the devices configured to realize different functions in the hardware component may also be considered as structures in the hardware component. Or, the devices configured to realize different functions may even be considered as not only software modules realizing a method, but also structures in the hardware component.

The system, apparatus, modules or units described in some embodiments above may be realized by a computer chip or entity, or realized by a product having a function. A typical device is a computer. Specifically, the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an e-mail device, a game console, a tablet computer, a wearable device or any combination of these devices.

For the convenience of description, when the apparatus is described, the apparatus is functionally divided into different units and these units are described respectively. In some embodiments, the functions of different units may be realized in one or more pieces of software and/or hardware.

Some embodiments of the application may provide a method, a system or a computer program product. Therefore, hardware-only embodiments, software-only embodiments or embodiments combining software with hardware may be adopted for the application. In addition, the embodiment of a computer program product which may be implemented on one or more computer accessible storage media (including but not limited to disk memory, CD-ROM and optical memory) containing computer program codes may be adopted for the application.

The application is described by reference to the flowchart and/or block diagram of the method, device (system) and computer program product of some embodiments of the application. Each process in the flowchart and/or block in the block diagram and the combination of the processes in the flowchart and/or the blocks in the block diagram may be realized by computer program commands. These computer program commands may be provided in a general-purpose computer, a dedicated computer, an embedded processor or the processor of other programmable data processing equipment to produce a machine so that the commands executed by a computer or the processor of other programmable data processing equipment may produce a device configured to realize the designated functions in one process or more processes in the flowchart and/or in one block or more blocks in the block diagram.

These computer program commands may also be stored in a computer-readable memory which may boot a computer or other programmable data processing equipment to work in a specific mode so that the commands stored in the computer-readable memory may produce manufactures including a command device. The command device realizes the designated functions in one process or more processes in the flowchart and/or in one block or more blocks in the block diagram.

These computer program commands may also be uploaded to a computer or other programmable data processing equipment so that a series of operation steps are performed on the computer or other programmable data processing equipment to produce the processing realized by the computer and the commands executed on the computer or other programmable data processing equipment provide the steps for realizing the designated functions in one process or more processes in the flowchart and/or in one block or more blocks in the block diagram.

In a typical configuration, a computer device comprises one or more processors (CPU), an input/output interface, a network interface and a memory.

The memory may include a volatile memory, a random-access memory (RAM) and/or a nonvolatile memory of computer-readable media, for example, a read-only memory or a flash RAM. The memory is an example of computer-readable media.

Computer-readable media include volatile and nonvolatile media and mobile and immobile media, and they may realize information storage by use of any method or technique. Information may be computer-readable commands, data structures, modules of a program or other data. Examples of storage media of a computer include but are not limited to phase-change RAM (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory techniques, compact disk read-only memory (CD-ROM), digital versatile disk (DVD), cassette tape, magnetic tape, magnetic disk or other storage device or any other non-transmission medium, and they may be configured to store information which may be accessed by a computer device. According to the definition in this document, computer-readable media excludes transitory media, for example, modulated data signals and carriers.

The terms “comprise” and “contain” and their variants are intended to cover non-exclusive inclusions so that the process, method, commodity or device comprising a series of elements not only comprises these elements, but also comprises other elements not listed clearly, or comprises the elements intrinsic to the process, method, commodity or device. Without any more restrictions, the element defined by “comprising one . . . ” do not exclude the case that other identical elements exist in the process, method, commodity or device which comprises the element.

Some embodiments of the application may provide a method, a system or a computer program product. Therefore, hardware-only embodiments, software-only embodiments or embodiments combining software with hardware may be adopted for the application. In addition, the embodiment of a computer program product which may be implemented on one or more computer accessible storage media (including but not limited to disk memory, CD-ROM and optical memory) containing computer program codes may be adopted for the application.

The application may be described in the general context of a computer executable command executed by a computer, for example, a program module. Generally, a program module comprises a routine, program, object, component and data structure which execute a specific task or realize a specific abstract data type. The application may also be practiced in distributed computing environments. In the distributed computing environments, tasks are executed by remote processing equipment connected over a communication network. In distributed computing environments, a program module may be located in a local or remote computer storage medium including a storage device.

The above are only embodiments of the application, but are not used to restrict the application. Those skilled in the art may make various changes and modifications to the application. Any modification, equivalent replacement, and improvement within the spirit and principle of the application should fall within the scope of the claims of the application. 

The invention claimed is:
 1. A method for paying a fare, comprising: establishing, by a fare-collecting device, a near field communication (NFC) connection with a user terminal; sending, by the fare-collecting device over the NFC connection, a first device ID of the fare-collecting device to the user terminal; receiving, by the fare-collecting device over the NFC connection, encrypted data transmitted from the user terminal; obtaining, by the fare-collecting device decrypting the encrypted data, an account ID of a user associated with the user terminal, a second device ID from the encrypted data, and a timestamp from the encrypted data, wherein the timestamp corresponds to a time when the encrypted data is encrypted; determining, by the fare-collecting device, whether the second device ID is consistent with the first device ID, and whether a time interval between a time corresponding to the timestamp and a current time is smaller than a preset time length; and in response to determining that the second device ID is consistent with the first device ID, and that the time interval between the time corresponding to the timestamp and the current time is smaller than the preset time length, sending, by the fare-collecting device over a computer network, the account ID to a server for the server to deduct a fare from an account corresponding to the account ID.
 2. The method as claimed in claim 1, wherein sending the account ID to the server comprises: sending the account ID to the server only when the second device ID is consistent with the first device ID.
 3. The method as claimed in claim 1, wherein the fare-collecting device comprises a gate, and the method further comprises: in response to determining the second device ID is not consistent with the first device ID, preventing, by the fare-collecting device, opening the gate.
 4. The method as claimed in claim 1, wherein the fare-collecting device comprises a gate, and the method further comprises: in response to determining the second device ID is consistent with the first device ID, opening, by the fare-collecting device, the gate.
 5. The method as claimed in claim 1, wherein: the fare-collecting device comprises a gate; the fare-collecting device is disconnected from the computer network; and sending the account ID to the server comprises, in response to determining that the second device ID is consistent with the first device ID: storing, by the fare-collecting device, the account ID for sending to the server after the fare-collecting device connects to the computer network; and opening, by the fare-collecting device, the gate.
 6. The method as claimed in claim 1, wherein: receiving encrypted data transmitted from the user terminal comprises: receiving, by the fare-collecting device, first encrypted data transmitted from the user terminal at a first point in time; and receiving, by the fare-collecting device, second encrypted data transmitted from the user terminal at a second point in time; and sending the account ID to the server comprises: determining, by the fare-collecting device, the fare based on the first encrypted data and the second encrypted data; and sending, by the fare-collecting device, the account ID and the fare to the server for the server to deduct the fare from the account corresponding to the account ID.
 7. A system, comprising a processor and a non-transitory computer-readable storage medium storing instructions executable by the processor to cause the system to perform operations comprising: establishing a near field communication (NFC) connection with a user terminal; sending, over the NFC connection, a first device ID of the system to the user terminal; receiving over the NFC connection, encrypted data transmitted from the user terminal; obtaining, by decrypting the encrypted data, an account ID of a user associated with the user terminal, a second device ID from the encrypted data, and a timestamp from the encrypted data, wherein the timestamp corresponds to a time when the encrypted data is encrypted; determining whether the second device ID is consistent with the first device ID, and whether a time interval between a time corresponding to the timestamp and a current time is smaller than a preset time length; and in response to determining that the second device ID is consistent with the first device ID, and that the time interval between the time corresponding to the timestamp and the current time is smaller than the preset time length, sending, over a computer network, the account ID to a server for the server to deduct a fare from an account corresponding to the account ID.
 8. The system as claimed in claim 7, wherein the sending the account ID to the server comprises: sending the account ID to the server only when the second device ID is consistent with the first device ID.
 9. The system as claimed in claim 7, further comprising a gate, and wherein the operations further comprise: in response to determining the second device ID is not consistent with the first device ID, preventing opening the gate.
 10. The system as claimed in claim 7, further comprising a gate, and wherein the operations further comprise: in response to determining the second device ID is consistent with the first device ID, opening the gate.
 11. The system as claimed in claim 7, further comprising a gate and being disconnected from the computer network, and wherein: sending the account ID to the server comprises: storing the account ID for sending to the server after the system connects to the computer network; and opening the gate.
 12. The system as claimed in claim 7, wherein: receiving the encrypted data transmitted from the user terminal comprises: receiving first encrypted data transmitted from the user terminal at a first point in time; and receiving second encrypted data transmitted from the user terminal at a second point in time; and sending the account ID to the server comprises: determining the fare based on the first encrypted data and the second encrypted data; and sending the account ID and the fare to the server for the server to deduct the fare from the account corresponding to the account ID.
 13. A non-transitory computer-readable storage medium for paying a fare, configured with instructions executable by one or more processors to cause the one or more processors to perform operations comprising: establishing a near field communication (NFC) connection with a user terminal; sending, over the NFC connection, a first device ID of the storage medium to the user terminal; receiving, over the NFC connection, encrypted data transmitted from the user terminal; obtaining, by decrypting the encrypted data, an account ID of a user associated with the user terminal, a second device ID from the encrypted data, and a timestamp from the encrypted data, wherein the timestamp corresponds to a time when the encrypted data is encrypted; determining whether the second device ID is consistent with the first device ID, and whether a time interval between a time corresponding to the timestamp and a current time is smaller than a preset time length; and in response to determining that the second device ID is consistent with the first device ID, and that the time interval between the time corresponding to the timestamp and the current time is smaller than the preset time length, sending, over a computer network, the account ID to a server for the server to deduct a fare from an account corresponding to the account ID.
 14. The non-transitory computer-readable storage medium as claimed in claim 13, wherein sending the account ID to the server comprises: sending the account ID to the server only when the second device ID is consistent with the first device ID.
 15. The non-transitory computer-readable storage medium as claimed in claim 13, further comprising a gate, and wherein the operations further comprise: in response to determining the second device ID is not consistent with the first device ID, preventing opening the gate.
 16. The non-transitory computer-readable storage medium as claimed in claim 13, further comprising a gate, and wherein the operations further comprise: in response to determining the second device ID is consistent with the first device ID, opening the gate.
 17. The non-transitory computer-readable storage medium as claimed in claim 13, further comprising a gate and being disconnected from the computer network, and wherein: sending the account ID to the server comprises: storing the account ID for sending to the server after the storage medium connects to the computer network; and opening the gate. 